CMAKE_MINIMUM_REQUIRED( VERSION 2.8 )

PROJECT( QMefoolTest )

FIND_PACKAGE( Qt4 COMPONENTS QtMain QtCore QtGui )

IF( QT4_FOUND )

	IF (MSVC)
		# Set Unicode as character set for Visual Studio projects. By default it's Multi-Byte
		ADD_DEFINITIONS(-DUNICODE -D_UNICODE)
				
		# Set Warning level to 4
	# Commented because Qt generates warnings...
	#	IF ( CMAKE_CXX_FLAGS MATCHES "/W[0-4]" )
	#		STRING( REGEX REPLACE "/W[0-4]" "/W4" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}" )
	#	ELSE()
	#		SET( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /W4" )
	#  ENDIF()
	ENDIF()


	INCLUDE_DIRECTORIES( ${MefoolLib_SOURCE_DIR} )

	SET	(	SOURCES
		
			MefoolQImageWidget.h
			MefoolQImageWidget.cpp
			MefoolQDeviceWidget.h
			MefoolQDeviceWidget.cpp
			MefoolQDeviceManagerWidget.h
			MefoolQDeviceManagerWidget.cpp
			
			Main.cpp 
		)

	QT4_WRAP_CPP( HEADERS_MOC MefoolQImageWidget.h )	
	QT4_WRAP_CPP( HEADERS_MOC MefoolQDeviceWidget.h )	
	QT4_WRAP_CPP( HEADERS_MOC MefoolQDeviceManagerWidget.h )

	INCLUDE( ${QT_USE_FILE} )
	ADD_DEFINITIONS( ${QT_DEFINITIONS} )

	ADD_EXECUTABLE( ${PROJECT_NAME} WIN32 ${SOURCES} ${HEADERS_MOC} )

	TARGET_LINK_LIBRARIES( ${PROJECT_NAME} MefoolLib )
	TARGET_LINK_LIBRARIES( ${PROJECT_NAME} ${QT_LIBRARIES}) 
	
ELSE()
	
	MESSAGE("Qt4 not found. Project ${PROJECT_NAME} skipped")
	
ENDIF()